package com.xinqing.test.LetCode;

/**
 * @Author:CHQ
 * @Date:2021/7/21 16:52
 * @Description
 */
public class RemoveDuplicates {
    public static void main(String args[]) {

        int[] nums={1,2,2,3,4};
        System.out.println(test(nums));


    }
    public static int test(int[] nums){
        int j=0;
        for(int i=0;i<nums.length;i++){
            if(nums[i]!=nums[j]){
                nums[++j]=nums[i];
            }
        }
        return j+1;
    }
}
